Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/service/src/androidMain/kotlin/org/meshtastic/core/service/worker/SendMessageWorker.kt e85300531e124df08788c1b765d50af1bf6d516d (e8530053) Text, 2.44 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.service.worker

Tff7b72import T7ee787android.content.Context
Tff7b72import T7ee787androidx.work.CoroutineWorker
Tff7b72import T7ee787androidx.work.WorkerParameters
Tff7b72import T7ee787org.koin.android.annotation.KoinWorker
Tff7b72import T7ee787org.meshtastic.core.model.ConnectionState
Tff7b72import T7ee787org.meshtastic.core.model.MessageStatus
Tff7b72import T7ee787org.meshtastic.core.model.RadioController
Tff7b72import T7ee787org.meshtastic.core.repository.PacketRepository

Tf0883e@KoinWorker
Tff7b72class T56d364SendMessageWorkerTb4b4b4(
Te6edf3contextTb4b4b4: Te6edf3ContextTb4b4b4,
Te6edf3paramsTb4b4b4: Te6edf3WorkerParametersTb4b4b4,
Tff7b72private Tff7b72val Te6edf3packetRepositoryTb4b4b4: Te6edf3PacketRepositoryTb4b4b4,
Tff7b72private Tff7b72val Te6edf3radioControllerTb4b4b4: Te6edf3RadioControllerTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3CoroutineWorkerTb4b4b4(Te6edf3contextTb4b4b4, Te6edf3paramsTb4b4b4) Tb4b4b4{

Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffTooGenericExceptionCaughtTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffSwallowedExceptionTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffReturnCountTa5d6ff"Tb4b4b4)
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffdoWorkTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3Result Tb4b4b4{
Tff7b72val Te6edf3packetId Tff7b72= Te6edf3inputDataTb4b4b4.Te6edf3getIntTb4b4b4(Te6edf3KEY_PACKET_IDTb4b4b4, T79c0ff0Tb4b4b4)
Tff7b72if Tb4b4b4(Te6edf3packetId Tff7b72=Tff7b72= T79c0ff0Tb4b4b4) Tff7b72return Te6edf3ResultTb4b4b4.Te6edf3failureTb4b4b4(Tb4b4b4)

T8b949e// Verify we are connected before attempting to send to avoid unnecessary Exception bubbling
Tff7b72if Tb4b4b4(Te6edf3radioControllerTb4b4b4.Te6edf3connectionStateTb4b4b4.Te6edf3value Tff7b72!Tff7b72= Te6edf3ConnectionStateTb4b4b4.Te6edf3ConnectedTb4b4b4) Tb4b4b4{
Tff7b72return Te6edf3ResultTb4b4b4.Te6edf3retryTb4b4b4(Tb4b4b4)
Tb4b4b4}

Tff7b72val Te6edf3packetData Tff7b72=
Te6edf3packetRepositoryTb4b4b4.Te6edf3getPacketByPacketIdTb4b4b4(Te6edf3packetIdTb4b4b4)
Tff7b72?: Tff7b72return Te6edf3ResultTb4b4b4.Te6edf3failureTb4b4b4(Tb4b4b4) T8b949e// Packet no longer exists in DB? Do not retry.

Tff7b72return Tff7b72try Tb4b4b4{
Te6edf3radioControllerTb4b4b4.Te6edf3sendMessageTb4b4b4(Te6edf3packetDataTb4b4b4)
Te6edf3packetRepositoryTb4b4b4.Te6edf3updateMessageStatusTb4b4b4(Te6edf3packetDataTb4b4b4, Te6edf3MessageStatusTb4b4b4.Te6edf3ENROUTETb4b4b4)
Te6edf3ResultTb4b4b4.Te6edf3successTb4b4b4(Tb4b4b4)
Tb4b4b4} Tff7b72catch Tb4b4b4(Te6edf3eTb4b4b4: Te6edf3ExceptionTb4b4b4) Tb4b4b4{
Te6edf3packetRepositoryTb4b4b4.Te6edf3updateMessageStatusTb4b4b4(Te6edf3packetDataTb4b4b4, Te6edf3MessageStatusTb4b4b4.Te6edf3QUEUEDTb4b4b4)
Te6edf3ResultTb4b4b4.Te6edf3retryTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Tff7b72companion Tff7b72object Tb4b4b4{
Tff7b72const Tff7b72val Te6edf3KEY_PACKET_ID Tff7b72= Ta5d6ff"Ta5d6ffpacket_idTa5d6ff"
Tff7b72const Tff7b72val Te6edf3WORK_NAME_PREFIX Tff7b72= Ta5d6ff"Ta5d6ffsend_message_Ta5d6ff"
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s